]> Shamusworld >> Repos - architektonas/commitdiff
Removed useless *Listener class and references.
authorShamus Hammons <jlhamm@acm.org>
Wed, 4 Aug 2010 03:48:21 +0000 (03:48 +0000)
committerShamus Hammons <jlhamm@acm.org>
Wed, 4 Aug 2010 03:48:21 +0000 (03:48 +0000)
30 files changed:
architektonas.pro
src/base/drawing.cpp
src/base/drawing.h
src/base/rs_arc.cpp
src/base/rs_blocklist.cpp
src/base/rs_blocklist.h
src/base/rs_blocklistlistener.h [deleted file]
src/base/rs_circle.cpp
src/base/rs_color.cpp
src/base/rs_document.cpp
src/base/rs_flags.h
src/base/rs_infoarea.h
src/base/rs_information.cpp
src/base/rs_information.h
src/base/rs_layer.h
src/base/rs_layerlist.cpp
src/base/rs_layerlist.h
src/base/rs_layerlistlistener.h [deleted file]
src/base/rs_modification.h
src/base/rs_solid.cpp
src/base/rs_undoable.h
src/mainapp/applicationwindow.cpp
src/widgets/qg_blockwidget.cpp
src/widgets/qg_blockwidget.h
src/widgets/qg_dialogfactory.cpp
src/widgets/qg_graphicview.h
src/widgets/qg_layerwidget.cpp
src/widgets/qg_layerwidget.h
src/widgets/qg_pentoolbar.cpp
src/widgets/qg_pentoolbar.h

index 3a8b72aa566caffadfb398910bfd78874e1e65e7..ede199f390b173dec4e90975fb56355df5ed0fe4 100644 (file)
@@ -33,7 +33,6 @@ HEADERS = \
        src/base/rs_atomicentity.h \
        src/base/rs_block.h \
        src/base/rs_blocklist.h \
-       src/base/rs_blocklistlistener.h \
        src/base/rs_circle.h \
        src/base/rs_clipboard.h \
        src/base/rs_color.h \
@@ -73,7 +72,6 @@ HEADERS = \
        src/base/rs_insert.h \
        src/base/rs_layer.h \
        src/base/rs_layerlist.h \
-       src/base/rs_layerlistlistener.h \
        src/base/rs_leader.h \
        src/base/rs_line.h \
        src/base/rs_linetypepattern.h \
@@ -140,6 +138,7 @@ SOURCES = \
        src/base/rs_filterdxf.cpp \
        src/base/rs_filterdxf1.cpp \
        src/base/rs_filterinterface.cpp \
+       src/base/rs_flags.cpp \
        src/base/rs_font.cpp \
        src/base/rs_fontlist.cpp \
        src/base/rs_grid.cpp \
index 3393bfc3e3921da2b12fc1dc9b8e71b23a77d943..a891bd46ca7da3edf9a70dfb2293b3417cf0138d 100644 (file)
@@ -302,6 +302,7 @@ void Drawing::freezeAllLayers(bool freeze)
        layerList.freezeAll(freeze);
 }
 
+#if 0
 void Drawing::addLayerListListener(RS_LayerListListener * listener)
 {
        layerList.addListener(listener);
@@ -311,6 +312,7 @@ void Drawing::removeLayerListListener(RS_LayerListListener * listener)
 {
        layerList.removeListener(listener);
 }
+#endif
 
 // Wrapper for block functions:
 
@@ -384,6 +386,7 @@ void Drawing::freezeAllBlocks(bool freeze)
        blockList.freezeAll(freeze);
 }
 
+#if 0
 void Drawing::addBlockListListener(RS_BlockListListener * listener)
 {
        blockList.addListener(listener);
@@ -393,6 +396,7 @@ void Drawing::removeBlockListListener(RS_BlockListListener * listener)
 {
        blockList.removeListener(listener);
 }
+#endif
 
 // Wrappers for variable functions:
 void Drawing::clearVariables()
@@ -462,6 +466,7 @@ QMultiHash<QString, RS_Variable *> & Drawing::getVariableDict()
 bool Drawing::isGridOn()
 {
        int on = getVariableInt("$GRIDMODE", 1);
+
        return (on != 0);
 }
 
@@ -479,9 +484,7 @@ void Drawing::setGridOn(bool on)
 void Drawing::setUnit(RS2::Unit u)
 {
        setPaperSize(RS_Units::convert(getPaperSize(), getUnit(), u));
-
        addVariable("$INSUNITS", (int)u, 70);
-
        //unit = u;
 }
 
@@ -606,7 +609,6 @@ void Drawing::setPaperInsertionBase(const Vector & p)
 Vector Drawing::getPaperSize()
 {
        Vector def = RS_Units::convert(Vector(210.0, 297.0), RS2::Millimeter, getUnit());
-
        Vector v1 = getVariableVector("$PLIMMIN", Vector(0.0, 0.0));
        Vector v2 = getVariableVector("$PLIMMAX", def);
 
@@ -753,8 +755,8 @@ std::ostream & operator<<(std::ostream & os, Drawing & g)
     os << "--- Drawing: \n";
     os << "---" << *g.getLayerList() << "\n";
     os << "---" << *g.getBlockList() << "\n";
-    os << "---" << (RS_Undo&)g << "\n";
-    os << "---" << (RS_EntityContainer&)g << "\n";
+    os << "---" << (RS_Undo &)g << "\n";
+    os << "---" << (RS_EntityContainer &)g << "\n";
 
     return os;
 }
index 22b22177e1578b235b87df493eb356f7c85d5666..a79447422afb1196fcbd73d4c9a0fe856f8f4773 100644 (file)
  */
 class Drawing: public RS_Document
 {
-public:
-    Drawing(RS_EntityContainer * parent = NULL);
-    virtual ~Drawing();
-
-    virtual RS2::EntityType rtti() const;
-    virtual unsigned long int countLayerEntities(RS_Layer * layer);
-    virtual RS_LayerList * getLayerList();
-    virtual RS_BlockList * getBlockList();
-    virtual void newDoc();
-    virtual bool save();
-    virtual bool saveAs(const QString& filename, RS2::FormatType type);
-    virtual bool open(const QString& filename, RS2::FormatType type);
-
-       // Wrappers for Layer functions:
-    void clearLayers();
-    uint countLayers() const;
-    RS_Layer * layerAt(uint i);
-    void activateLayer(const QString & name);
-    void activateLayer(RS_Layer * layer);
-    RS_Layer * getActiveLayer();
-    virtual void addLayer(RS_Layer * layer);
-    virtual void removeLayer(RS_Layer * layer);
-    virtual void editLayer(RS_Layer * layer, const RS_Layer & source);
-    RS_Layer * findLayer(const QString & name);
-    void toggleLayer(const QString & name);
-    void toggleLayer(RS_Layer * layer);
-    void toggleLayerLock(RS_Layer * layer);
-    void freezeAllLayers(bool freeze);
-    void addLayerListListener(RS_LayerListListener * listener);
-    void removeLayerListListener(RS_LayerListListener * listener);
-
-       // Wrapper for block functions:
-    void clearBlocks();
-    uint countBlocks();
-    RS_Block * blockAt(uint i);
-    void activateBlock(const QString & name);
-    void activateBlock(RS_Block * block);
-    RS_Block * getActiveBlock();
-    virtual bool addBlock(RS_Block * block, bool notify = true);
-    virtual void addBlockNotification();
-    virtual void removeBlock(RS_Block * block);
-    RS_Block * findBlock(const QString & name);
-    QString newBlockName();
-    void toggleBlock(const QString & name);
-    void toggleBlock(RS_Block * block);
-    void freezeAllBlocks(bool freeze);
-    void addBlockListListener(RS_BlockListListener * listener);
-    void removeBlockListListener(RS_BlockListListener * listener);
-
-       // Wrappers for variable functions:
-    void clearVariables();
-    int countVariables();
-    void addVariable(const QString & key, const Vector & value, int code);
-    void addVariable(const QString & key, const QString & value, int code);
-    void addVariable(const QString & key, int value, int code);
-    void addVariable(const QString & key, double value, int code);
-    Vector getVariableVector(const QString & key, const Vector & def);
-    QString getVariableString(const QString & key, const QString & def);
-    int getVariableInt(const QString & key, int def);
-    double getVariableDouble(const QString & key, double def);
-    void removeVariable(const QString & key);
-//     Q3Dict<RS_Variable> & getVariableDict();
-       QMultiHash<QString, RS_Variable *> & getVariableDict();
-
-       RS2::LinearFormat getLinearFormat();
-       int getLinearPrecision();
-       RS2::AngleFormat getAngleFormat();
-       int getAnglePrecision();
-
-       Vector getPaperSize();
-       void setPaperSize(const Vector & s);
-
-       Vector getPaperInsertionBase();
-       void setPaperInsertionBase(const Vector & p);
-
-       RS2::PaperFormat getPaperFormat(bool * landscape);
-       void setPaperFormat(RS2::PaperFormat f, bool landscape);
-
-       double getPaperScale();
-       void setPaperScale(double s);
-
-    virtual void setUnit(RS2::Unit u);
-    virtual RS2::Unit getUnit();
-
-       bool isGridOn();
-       void setGridOn(bool on);
-
-       bool isDraftOn();
-       void setDraftOn(bool on);
-
-       void centerToPage();
-       void fitToPage();
-    virtual bool isModified() const;
-       virtual void setModified(bool m);
-
+       public:
+               Drawing(RS_EntityContainer * parent = NULL);
+               virtual ~Drawing();
+
+               virtual RS2::EntityType rtti() const;
+               virtual unsigned long int countLayerEntities(RS_Layer * layer);
+               virtual RS_LayerList * getLayerList();
+               virtual RS_BlockList * getBlockList();
+               virtual void newDoc();
+               virtual bool save();
+               virtual bool saveAs(const QString& filename, RS2::FormatType type);
+               virtual bool open(const QString& filename, RS2::FormatType type);
+
+               // Wrappers for Layer functions:
+               void clearLayers();
+               uint countLayers() const;
+               RS_Layer * layerAt(uint i);
+               void activateLayer(const QString & name);
+               void activateLayer(RS_Layer * layer);
+               RS_Layer * getActiveLayer();
+               virtual void addLayer(RS_Layer * layer);
+               virtual void removeLayer(RS_Layer * layer);
+               virtual void editLayer(RS_Layer * layer, const RS_Layer & source);
+               RS_Layer * findLayer(const QString & name);
+               void toggleLayer(const QString & name);
+               void toggleLayer(RS_Layer * layer);
+               void toggleLayerLock(RS_Layer * layer);
+               void freezeAllLayers(bool freeze);
+//         void addLayerListListener(RS_LayerListListener * listener);
+//         void removeLayerListListener(RS_LayerListListener * listener);
+
+               // Wrapper for block functions:
+               void clearBlocks();
+               uint countBlocks();
+               RS_Block * blockAt(uint i);
+               void activateBlock(const QString & name);
+               void activateBlock(RS_Block * block);
+               RS_Block * getActiveBlock();
+               virtual bool addBlock(RS_Block * block, bool notify = true);
+               virtual void addBlockNotification();
+               virtual void removeBlock(RS_Block * block);
+               RS_Block * findBlock(const QString & name);
+               QString newBlockName();
+               void toggleBlock(const QString & name);
+               void toggleBlock(RS_Block * block);
+               void freezeAllBlocks(bool freeze);
+//         void addBlockListListener(RS_BlockListListener * listener);
+//         void removeBlockListListener(RS_BlockListListener * listener);
+
+               // Wrappers for variable functions:
+               void clearVariables();
+               int countVariables();
+               void addVariable(const QString & key, const Vector & value, int code);
+               void addVariable(const QString & key, const QString & value, int code);
+               void addVariable(const QString & key, int value, int code);
+               void addVariable(const QString & key, double value, int code);
+               Vector getVariableVector(const QString & key, const Vector & def);
+               QString getVariableString(const QString & key, const QString & def);
+               int getVariableInt(const QString & key, int def);
+               double getVariableDouble(const QString & key, double def);
+               void removeVariable(const QString & key);
+       //      Q3Dict<RS_Variable> & getVariableDict();
+               QMultiHash<QString, RS_Variable *> & getVariableDict();
+
+               RS2::LinearFormat getLinearFormat();
+               int getLinearPrecision();
+               RS2::AngleFormat getAngleFormat();
+               int getAnglePrecision();
+               Vector getPaperSize();
+               void setPaperSize(const Vector & s);
+               Vector getPaperInsertionBase();
+               void setPaperInsertionBase(const Vector & p);
+               RS2::PaperFormat getPaperFormat(bool * landscape);
+               void setPaperFormat(RS2::PaperFormat f, bool landscape);
+               double getPaperScale();
+               void setPaperScale(double s);
+               virtual void setUnit(RS2::Unit u);
+               virtual RS2::Unit getUnit();
+               bool isGridOn();
+               void setGridOn(bool on);
+               bool isDraftOn();
+               void setDraftOn(bool on);
+               void centerToPage();
+               void fitToPage();
+               virtual bool isModified() const;
+               virtual void setModified(bool m);
 #ifdef RS_CAM
-       RS_CamData & getCamData();
-       void setCamData(const RS_CamData & d);
+               RS_CamData & getCamData();
+               void setCamData(const RS_CamData & d);
 #endif
 
-    friend std::ostream & operator<<(std::ostream & os, Drawing & g);
+               friend std::ostream & operator<<(std::ostream & os, Drawing & g);
 
-private:
-       RS_LayerList layerList;
-       RS_BlockList blockList;
-       RS_VariableDict variableDict;
+       private:
+               RS_LayerList layerList;
+               RS_BlockList blockList;
+               RS_VariableDict variableDict;
 #ifdef RS_CAM
-       RS_CamData camData;
+               RS_CamData camData;
 #endif
 };
 
index 60755a25f740dde63a57e2ab25458441bc8c7c8b..5fac5819d5d6f358f520acbcb18649ede4b49cdc 100644 (file)
 #include "rs_arc.h"
 
 #include "rs_constructionline.h"
+#include "rs_debug.h"
+#include "graphicview.h"
 #include "rs_linetypepattern.h"
 #include "rs_information.h"
 #include "rs_math.h"
-#include "graphicview.h"
 #include "paintinterface.h"
 
 /**
index 8a16a1a9b229ef7875f1587ced7046015cfadee6..76e78e97936653513c36e093de8f06847eeada47 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "rs_blocklist.h"
 
+#include "rs_debug.h"
+
 /**
  * Constructor.
  *
@@ -148,11 +150,13 @@ bool RS_BlockList::add(RS_Block * block, bool notify)
  */
 void RS_BlockList::addNotification()
 {
+#if 0
        for(int i=0; i<blockListListeners.count(); ++i)
        {
                RS_BlockListListener * l = blockListListeners.at(i);
                l->blockAdded(NULL);
        }
+#endif
 }
 
 /**
@@ -168,11 +172,13 @@ void RS_BlockList::remove(RS_Block * block)
 //     blocks.remove(block);
        blocks.removeAll(block);
 
+#if 0
        for(int i=0; i<blockListListeners.count(); ++i)
        {
                RS_BlockListListener * l = blockListListeners.at(i);
                l->blockRemoved(block);
        }
+#endif
 
        setModified(true);
 
@@ -288,6 +294,7 @@ void RS_BlockList::toggle(RS_Block * block)
 
        block->toggle();
 
+#if 0
        // Notify listeners:
        for(int i=0; i<blockListListeners.count(); ++i)
        {
@@ -295,6 +302,7 @@ void RS_BlockList::toggle(RS_Block * block)
 
                l->blockToggled(block);
        }
+#endif
 }
 
 /**
@@ -307,11 +315,13 @@ void RS_BlockList::freezeAll(bool freeze)
        for(uint l=0; l<count(); l++)
                at(l)->freeze(freeze);
 
+#if 0
        for(int i=0; i<blockListListeners.count(); ++i)
        {
                RS_BlockListListener * l = blockListListeners.at(i);
                l->blockToggled(NULL);
        }
+#endif
 }
 
 /**
@@ -336,6 +346,7 @@ void RS_BlockList::toggleBlock(const QString& name) {
  * adds a BlockListListener to the list of listeners. Listeners
  * are notified when the block list changes.
  */
+#if 0
 void RS_BlockList::addListener(RS_BlockListListener * listener)
 {
        blockListListeners.append(listener);
@@ -346,9 +357,9 @@ void RS_BlockList::addListener(RS_BlockListListener * listener)
  */
 void RS_BlockList::removeListener(RS_BlockListListener * listener)
 {
-//     blockListListeners.remove(listener);
        blockListListeners.removeAll(listener);
 }
+#endif
 
 /**
  * Sets the layer lists modified status to 'm'.
@@ -383,4 +394,3 @@ std::ostream & operator<<(std::ostream & os, RS_BlockList & b)
 
        return os;
 }
-
index fecaef09c0f367a8f146ae6750d8e4fe56fc331e..ed1dc8ce583d4557f2b147ba84a4bc014efba7d0 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <QtCore>
 #include "rs_block.h"
-#include "rs_blocklistlistener.h"
+//#include "rs_blocklistlistener.h"
 #include "rs_entity.h"
 
 /**
@@ -22,11 +22,9 @@ class RS_BlockList
                void clear();
                uint count();
                RS_Block * at(uint i);
-
                void activate(const QString & name);
                void activate(RS_Block * block);
                RS_Block * getActive();
-
                virtual bool add(RS_Block * block, bool notify = true);
                virtual void addNotification();
                virtual void remove(RS_Block * block);
@@ -37,10 +35,8 @@ class RS_BlockList
                void toggle(const QString & name);
                void toggle(RS_Block * block);
                void freezeAll(bool freeze);
-
-               void addListener(RS_BlockListListener * listener);
-               void removeListener(RS_BlockListListener * listener);
-
+//             void addListener(RS_BlockListListener * listener);
+//             void removeListener(RS_BlockListListener * listener);
                void setModified(bool m);
                virtual bool isModified() const;
 
@@ -50,11 +46,9 @@ class RS_BlockList
                //! Is the list owning the blocks?
                bool owner;
                //! Blocks in the graphic
-//             Q3PtrList<RS_Block> blocks;
                QList<RS_Block *> blocks;
                //! List of registered BlockListListeners
-//             Q3PtrList<RS_BlockListListener> blockListListeners;
-               QList<RS_BlockListListener *> blockListListeners;
+//             QList<RS_BlockListListener *> blockListListeners;
                //! Currently active block
                RS_Block * activeBlock;
                /** Flag set if the layer list was modified and not yet saved. */
diff --git a/src/base/rs_blocklistlistener.h b/src/base/rs_blocklistlistener.h
deleted file mode 100644 (file)
index 2581f92..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef RS_BLOCKLISTLISTENER_H
-#define RS_BLOCKLISTLISTENER_H
-
-#include "rs_block.h"
-
-/**
- * This class is an interface for classes that are interested in
- * knowing about changes in the block list.
- */
-class RS_BlockListListener
-{
-       public:
-               RS_BlockListListener() {}
-               virtual ~RS_BlockListListener() {}
-
-               /**
-                * Called when the active block changes.
-                */
-               virtual void blockActivated(RS_Block*) {}
-
-               /**
-                * Called when a new block is added to the list.
-                */
-               virtual void blockAdded(RS_Block*) {}
-
-               /**
-                * Called when a block is removed from the list.
-                */
-               virtual void blockRemoved(RS_Block*) {}
-
-               /**
-                * Called when a block's attributes are modified.
-                */
-               virtual void blockEdited(RS_Block*) {}
-
-               /**
-                * Called when a block's visibility is toggled.
-                */
-               virtual void blockToggled(RS_Block*) {}
-};
-
-#endif
index 3291451c6242d01e65872366975cdeb6d2ee24a5..563c42a13a0ccad41f85e2135df924d29186ab8d 100644 (file)
 #include "rs_circle.h"
 
 #include "rs_constructionline.h"
+#include "rs_debug.h"
+#include "graphicview.h"
 #include "rs_information.h"
 #include "rs_linetypepattern.h"
-#include "graphicview.h"
 #include "paintinterface.h"
 
 /**
index 6fd40963017afc3b804a7fda56e74052185bdb36..14d79614502858d4c824e93aa99caf7581091ffa 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "rs_color.h"
 
+#include "rs.h"
+
 RS_Color::RS_Color(): QColor(), RS_Flags()
 {
 }
index b4aa5cbc80a3dc0cef369cfb986a73d147bc7448..8279b38457f41c491cc970145977b0f499eb42f4 100644 (file)
@@ -16,6 +16,8 @@
 
 #include "rs_document.h"
 
+#include "rs_debug.h"
+
 /**
  * Constructor.
  *
index ab32848f490b4a1017efc87f5c35de30bcda090b..e127a40a1eda36f6750636d783ea2d6d83603b1b 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef RS_FLAGS_H
 #define RS_FLAGS_H
 
-#include "rs.h"
-#include "rs_debug.h"
-
 /**
  * Base class for objects which have flags.
  *
  */
 class RS_Flags
 {
-public:
-    /** Default constructor. Resets all flags to 0. */
-    RS_Flags() {
-        flags = 0;
-    }
-
-    /** Constructor with initialisation to the given flags. */
-    RS_Flags(unsigned int f) {
-        flags = f;
-    }
-
-    virtual ~RS_Flags() {}
-
-    unsigned int getFlags() const {
-        return flags;
-    }
-
-    void resetFlags() {
-        flags=0;
-    }
-
-    void setFlags(unsigned int f) {
-        flags=f;
-    }
-
-    void setFlag(unsigned int f) {
-        flags=flags|f;
-    }
-
-    void delFlag(unsigned int f) {
-        flags=flags&(~f);
-    }
-
-    void toggleFlag(unsigned int f) {
-        flags=flags^f;
-    }
-
-    bool getFlag(unsigned int f) const {
-        if(flags&f) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-private:
-    unsigned int flags;
+       public:
+               RS_Flags();
+               RS_Flags(unsigned int f);
+               virtual ~RS_Flags();
+
+               unsigned int getFlags() const;
+               void resetFlags();
+               void setFlags(unsigned int f);
+               void setFlag(unsigned int f);
+               void delFlag(unsigned int f);
+               void toggleFlag(unsigned int f) ;
+               bool getFlag(unsigned int f) const;
+
+       private:
+               unsigned int flags;
 };
 
 #endif
index 31f3738a8b9410310881ecb5a542369129490184..4bc2fb24ee4801556ebbbc3aff33cd88b46268a4 100644 (file)
@@ -27,8 +27,6 @@ class RS_InfoArea
 
        private:
                double calcSubArea(const Vector & p1, const Vector & p2);
-
-//             Q3ValueVector<Vector> thePoints;
                QVector<Vector> thePoints;
                double baseY;
                double area;
index c836a2fa7e3f8f3b5fb3a44fdd7fbe4947305181..54a31809be2e6c9803b43e694a2fd6cef0864050 100644 (file)
@@ -17,6 +17,7 @@
 #include "rs_information.h"
 
 #include "rs_constructionline.h"
+#include "rs_debug.h"
 
 /**
  * Default constructor.
@@ -36,33 +37,36 @@ RS_Information::RS_Information(RS_EntityContainer& container)
  */
 bool RS_Information::isDimension(RS2::EntityType type)
 {
-    if (type==RS2::EntityDimAligned ||
-            type==RS2::EntityDimLinear ||
-            type==RS2::EntityDimRadial ||
-            type==RS2::EntityDimDiametric ||
-            type==RS2::EntityDimAngular) {
-        return true;
-    } else {
-        return false;
-    }
+       if (type == RS2::EntityDimAligned || type == RS2::EntityDimLinear
+               || type == RS2::EntityDimRadial || type == RS2::EntityDimDiametric
+               || type == RS2::EntityDimAngular)
+       {
+               return true;
+       }
+       else
+       {
+               return false;
+       }
 }
 
-
-
 /**
  * @retval true the entity can be trimmed.
  * i.e. it is in a graphic or in a polyline.
  */
-bool RS_Information::isTrimmable(RS_Entity* e) {
-       if (e!=NULL) {
-               if (e->getParent()!=NULL) {
-                       if (e->getParent()->rtti()==RS2::EntityPolyline) {
+bool RS_Information::isTrimmable(RS_Entity * e)
+{
+       if (e)
+       {
+               if (e->getParent())
+               {
+                       if (e->getParent()->rtti() == RS2::EntityPolyline)
+                       {
                                return true;
                        }
-                       else if (e->getParent()->rtti()==RS2::EntityContainer ||
-                                 e->getParent()->rtti()==RS2::EntityGraphic ||
-                                         e->getParent()->rtti()==RS2::EntityBlock) {
-
+                       else if (e->getParent()->rtti() == RS2::EntityContainer
+                               || e->getParent()->rtti() == RS2::EntityGraphic
+                               || e->getParent()->rtti() == RS2::EntityBlock)
+                       {
                                // normal entity:
                                return true;
                        }
@@ -72,54 +76,58 @@ bool RS_Information::isTrimmable(RS_Entity* e) {
        return false;
 }
 
-
 /**
  * @retval true the two entities can be trimmed to each other;
  * i.e. they are in a graphic or in the same polyline.
  */
-bool RS_Information::isTrimmable(RS_Entity* e1, RS_Entity* e2) {
-       if (e1!=NULL && e2!=NULL) {
-               if (e1->getParent()!=NULL && e2->getParent()!=NULL) {
-                       if (e1->getParent()->rtti()==RS2::EntityPolyline &&
-                          e2->getParent()->rtti()==RS2::EntityPolyline &&
-                          e1->getParent()==e2->getParent()) {
-
+bool RS_Information::isTrimmable(RS_Entity * e1, RS_Entity * e2)
+{
+       if (e1 && e2)
+       {
+               if (e1->getParent() && e2->getParent())
+               {
+                       if (e1->getParent()->rtti() == RS2::EntityPolyline
+                               && e2->getParent()->rtti() == RS2::EntityPolyline
+                               && e1->getParent()==e2->getParent())
+                       {
                                // in the same polyline
-                               RS_EntityContainer* pl = e1->getParent();
+                               RS_EntityContainer * pl = e1->getParent();
                                int idx1 = pl->findEntity(e1);
                                int idx2 = pl->findEntity(e2);
-                               RS_DEBUG->print("RS_Information::isTrimmable: "
-                                       "idx1: %d, idx2: %d", idx1, idx2);
-                               if (abs(idx1-idx2)==1 || abs(idx1-idx2)==pl->count()-1) {
+                               RS_DEBUG->print("RS_Information::isTrimmable: idx1: %d, idx2: %d", idx1, idx2);
+
+                               if (abs(idx1 - idx2) == 1 || abs(idx1 - idx2) == pl->count() - 1)
+                               {
                                        // directly following entities
                                        return true;
                                }
-                               else {
+                               else
+                               {
                                        // not directly following entities
                                        return false;
                                }
                        }
-                       else if ((e1->getParent()->rtti()==RS2::EntityContainer ||
-                                 e1->getParent()->rtti()==RS2::EntityGraphic ||
-                                         e1->getParent()->rtti()==RS2::EntityBlock) &&
-                                        (e2->getParent()->rtti()==RS2::EntityContainer ||
-                                 e2->getParent()->rtti()==RS2::EntityGraphic ||
-                                         e2->getParent()->rtti()==RS2::EntityBlock)) {
-
+                       else if ((e1->getParent()->rtti() == RS2::EntityContainer
+                               || e1->getParent()->rtti() == RS2::EntityGraphic
+                               || e1->getParent()->rtti() == RS2::EntityBlock)
+                               && (e2->getParent()->rtti() == RS2::EntityContainer
+                               || e2->getParent()->rtti() == RS2::EntityGraphic
+                               || e2->getParent()->rtti() == RS2::EntityBlock))
+                       {
                                // normal entities:
                                return true;
                        }
                }
-               else {
+               else
+               {
                        // independent entities with the same parent:
-                       return (e1->getParent()==e2->getParent());
+                       return (e1->getParent() == e2->getParent());
                }
        }
 
        return false;
 }
 
-
 /**
  * Gets the nearest end point to the given coordinate.
  *
@@ -129,12 +137,11 @@ bool RS_Information::isTrimmable(RS_Entity* e1, RS_Entity* e2) {
  * if there are no elements at all in this graphics
  * container.
  */
-Vector RS_Information::getNearestEndpoint(const Vector& coord,
-        double* dist) const {
-    return container->getNearestEndpoint(coord, dist);
+Vector RS_Information::getNearestEndpoint(const Vector & coord, double * dist) const
+{
+       return container->getNearestEndpoint(coord, dist);
 }
 
-
 /**
  * Gets the nearest point to the given coordinate which is on an entity.
  *
@@ -148,15 +155,12 @@ Vector RS_Information::getNearestEndpoint(const Vector& coord,
  * if there are no elements at all in this graphics
  * container.
  */
-Vector RS_Information::getNearestPointOnEntity(const Vector& coord,
-        bool onEntity,
-        double* dist,
-        RS_Entity** entity) const {
-
-    return container->getNearestPointOnEntity(coord, onEntity, dist, entity);
+Vector RS_Information::getNearestPointOnEntity(const Vector & coord,
+       bool onEntity, double * dist, RS_Entity ** entity) const
+{
+       return container->getNearestPointOnEntity(coord, onEntity, dist, entity);
 }
 
-
 /**
  * Gets the nearest entity to the given coordinate.
  *
@@ -168,15 +172,12 @@ Vector RS_Information::getNearestPointOnEntity(const Vector& coord,
  * @return the entity found or NULL if there are no elements
  * at all in this graphics container.
  */
-RS_Entity* RS_Information::getNearestEntity(const Vector& coord,
-        double* dist,
-        RS2::ResolveLevel level) const {
-
-    return container->getNearestEntity(coord, dist, level);
+RS_Entity * RS_Information::getNearestEntity(const Vector & coord,
+       double * dist, RS2::ResolveLevel level) const
+{
+       return container->getNearestEntity(coord, dist, level);
 }
 
-
-
 /**
  * Calculates the intersection point(s) between two entities.
  *
@@ -189,478 +190,456 @@ RS_Entity* RS_Information::getNearestEntity(const Vector& coord,
  * @return All intersections of the two entities. The tangent flag in
  * VectorSolutions is set if one intersection is a tangent point.
  */
-VectorSolutions RS_Information::getIntersection(RS_Entity* e1,
-        RS_Entity* e2, bool onEntities) {
-
-    VectorSolutions ret;
+VectorSolutions RS_Information::getIntersection(RS_Entity * e1,
+       RS_Entity * e2, bool onEntities)
+{
+       VectorSolutions ret;
        double tol = 1.0e-4;
 
-    if (e1==NULL || e2==NULL) {
-        return ret;
-    }
-
-    // unsupported entities / entity combinations:
-    if ((e1->rtti()==RS2::EntityEllipse && e2->rtti()==RS2::EntityEllipse) ||
-            e1->rtti()==RS2::EntityText || e2->rtti()==RS2::EntityText ||
-            isDimension(e1->rtti()) || isDimension(e2->rtti())) {
-
-        return ret;
-    }
-
-    // (only) one entity is an ellipse:
-    if (e1->rtti()==RS2::EntityEllipse || e2->rtti()==RS2::EntityEllipse) {
-        if (e2->rtti()==RS2::EntityEllipse) {
-            RS_Entity* tmp = e1;
-            e1 = e2;
-            e2 = tmp;
-        }
-        if (e2->rtti()==RS2::EntityLine) {
-            RS_Ellipse* ellipse = (RS_Ellipse*)e1;
-            ret = getIntersectionLineEllipse((RS_Line*)e2, ellipse);
-                       tol = 1.0e-1;
-        }
+       if (!e1 || !e2)
+               return ret;
 
+       // unsupported entities / entity combinations:
+       if ((e1->rtti() == RS2::EntityEllipse && e2->rtti() == RS2::EntityEllipse)
+               || e1->rtti() == RS2::EntityText || e2->rtti() == RS2::EntityText
+               || isDimension(e1->rtti()) || isDimension(e2->rtti()))
+       {
+               return ret;
+       }
+
+       // (only) one entity is an ellipse:
+       if (e1->rtti() == RS2::EntityEllipse || e2->rtti() == RS2::EntityEllipse)
+       {
+               if (e2->rtti() == RS2::EntityEllipse)
+               {
+                       RS_Entity * tmp = e1;
+                       e1 = e2;
+                       e2 = tmp;
+               }
+
+               if (e2->rtti() == RS2::EntityLine)
+               {
+                       RS_Ellipse * ellipse = (RS_Ellipse *)e1;
+                       ret = getIntersectionLineEllipse((RS_Line *)e2, ellipse);
+                       tol = 1.0e-1;
+               }
                // ellipse / arc, ellipse / ellipse: not supported:
-               else {
-            return ret;
-        }
-    } else {
+               else
+               {
+                       return ret;
+               }
+       }
+       else
+       {
+               RS_Entity * te1 = e1;
+               RS_Entity * te2 = e2;
+
+               // entity copies - so we only have to deal with lines and arcs
+               RS_Line l1(NULL, RS_LineData(Vector(0.0, 0.0), Vector(0.0, 0.0)));
+               RS_Line l2(NULL, RS_LineData(Vector(0.0, 0.0), Vector(0.0, 0.0)));
+
+               RS_Arc a1(NULL, RS_ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false));
+               RS_Arc a2(NULL, RS_ArcData(Vector(0.0, 0.0), 1.0, 0.0, 2 * M_PI, false));
+
+               // convert construction lines to lines:
+               if (e1->rtti() == RS2::EntityConstructionLine)
+               {
+                       RS_ConstructionLine * cl = (RS_ConstructionLine *)e1;
+                       l1.setStartpoint(cl->getPoint1());
+                       l1.setEndpoint(cl->getPoint2());
+                       te1 = &l1;
+               }
 
-        RS_Entity* te1 = e1;
-        RS_Entity* te2 = e2;
+               if (e2->rtti() == RS2::EntityConstructionLine)
+               {
+                       RS_ConstructionLine * cl = (RS_ConstructionLine *)e2;
+                       l2.setStartpoint(cl->getPoint1());
+                       l2.setEndpoint(cl->getPoint2());
+                       te2 = &l2;
+               }
 
-        // entity copies - so we only have to deal with lines and arcs
-        RS_Line l1(NULL,
-                   RS_LineData(Vector(0.0, 0.0), Vector(0.0,0.0)));
-        RS_Line l2(NULL,
-                   RS_LineData(Vector(0.0, 0.0), Vector(0.0,0.0)));
+               // convert circles to arcs:
+               if (e1->rtti() == RS2::EntityCircle)
+               {
+                       RS_Circle * c = (RS_Circle *)e1;
+                       RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false);
+                       a1.setData(data);
+                       te1 = &a1;
+               }
 
-        RS_Arc a1(NULL,
-                  RS_ArcData(Vector(0.0,0.0), 1.0, 0.0, 2*M_PI, false));
-        RS_Arc a2(NULL,
-                  RS_ArcData(Vector(0.0,0.0), 1.0, 0.0, 2*M_PI, false));
+               if (e2->rtti() == RS2::EntityCircle)
+               {
+                       RS_Circle * c = (RS_Circle *)e2;
+                       RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2 * M_PI, false);
+                       a2.setData(data);
+                       te2 = &a2;
+               }
 
-        // convert construction lines to lines:
-        if (e1->rtti()==RS2::EntityConstructionLine) {
-            RS_ConstructionLine* cl = (RS_ConstructionLine*)e1;
-
-            l1.setStartpoint(cl->getPoint1());
-            l1.setEndpoint(cl->getPoint2());
-
-            te1 = &l1;
-        }
-        if (e2->rtti()==RS2::EntityConstructionLine) {
-            RS_ConstructionLine* cl = (RS_ConstructionLine*)e2;
-
-            l2.setStartpoint(cl->getPoint1());
-            l2.setEndpoint(cl->getPoint2());
-
-            te2 = &l2;
-        }
-
-
-        // convert circles to arcs:
-        if (e1->rtti()==RS2::EntityCircle) {
-            RS_Circle* c = (RS_Circle*)e1;
-
-            RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2*M_PI, false);
-            a1.setData(data);
-
-            te1 = &a1;
-        }
-        if (e2->rtti()==RS2::EntityCircle) {
-            RS_Circle* c = (RS_Circle*)e2;
-
-            RS_ArcData data(c->getCenter(), c->getRadius(), 0.0, 2*M_PI, false);
-            a2.setData(data);
-
-            te2 = &a2;
-        }
-
-
-        // line / line:
-        //
-        //else
-        if (te1->rtti()==RS2::EntityLine &&
-                te2->rtti()==RS2::EntityLine) {
-
-            RS_Line* line1 = (RS_Line*)te1;
-            RS_Line* line2 = (RS_Line*)te2;
-
-            ret = getIntersectionLineLine(line1, line2);
-        }
-
-        // line / arc:
-        //
-        else if (te1->rtti()==RS2::EntityLine &&
-                 te2->rtti()==RS2::EntityArc) {
-
-            RS_Line* line = (RS_Line*)te1;
-            RS_Arc* arc = (RS_Arc*)te2;
-
-            ret = getIntersectionLineArc(line, arc);
-        }
-
-        // arc / line:
-        //
-        else if (te1->rtti()==RS2::EntityArc &&
-                 te2->rtti()==RS2::EntityLine) {
-
-            RS_Arc* arc = (RS_Arc*)te1;
-            RS_Line* line = (RS_Line*)te2;
-
-            ret = getIntersectionLineArc(line, arc);
-        }
-
-        // arc / arc:
-        //
-        else if (te1->rtti()==RS2::EntityArc &&
-                 te2->rtti()==RS2::EntityArc) {
-
-            RS_Arc* arc1 = (RS_Arc*)te1;
-            RS_Arc* arc2 = (RS_Arc*)te2;
-
-            ret = getIntersectionArcArc(arc1, arc2);
-        } else {
-            RS_DEBUG->print("RS_Information::getIntersection:: Unsupported entity type.");
-        }
-    }
-
-
-    // Check all intersection points for being on entities:
-    //
-    if (onEntities==true) {
-        if (!e1->isPointOnEntity(ret.get(0), tol) ||
-                !e2->isPointOnEntity(ret.get(0), tol)) {
-            ret.set(0, Vector(false));
-        }
-        if (!e1->isPointOnEntity(ret.get(1), tol) ||
-                !e2->isPointOnEntity(ret.get(1), tol)) {
-            ret.set(1, Vector(false));
-        }
-        if (!e1->isPointOnEntity(ret.get(2), tol) ||
-                !e2->isPointOnEntity(ret.get(2), tol)) {
-            ret.set(2, Vector(false));
-        }
-        if (!e1->isPointOnEntity(ret.get(3), tol) ||
-                !e2->isPointOnEntity(ret.get(3), tol)) {
-            ret.set(3, Vector(false));
-        }
-    }
-
-    int k=0;
-    for (int i=0; i<4; ++i) {
-        if (ret.get(i).valid) {
-            ret.set(k, ret.get(i));
-            k++;
-        }
-    }
-    for (int i=k; i<4; ++i) {
-        ret.set(i, Vector(false));
-    }
-
-    return ret;
-}
+               // line / line:
+               //
+               //else
+               if (te1->rtti() == RS2::EntityLine && te2->rtti() == RS2::EntityLine)
+               {
+                       RS_Line * line1 = (RS_Line *)te1;
+                       RS_Line * line2 = (RS_Line *)te2;
+                       ret = getIntersectionLineLine(line1, line2);
+               }
+               // line / arc:
+               //
+               else if (te1->rtti() == RS2::EntityLine && te2->rtti() == RS2::EntityArc)
+               {
+                       RS_Line * line = (RS_Line *)te1;
+                       RS_Arc * arc = (RS_Arc *)te2;
+                       ret = getIntersectionLineArc(line, arc);
+               }
+               // arc / line:
+               //
+               else if (te1->rtti() == RS2::EntityArc && te2->rtti() == RS2::EntityLine)
+               {
+                       RS_Arc * arc = (RS_Arc *)te1;
+                       RS_Line * line = (RS_Line *)te2;
+                       ret = getIntersectionLineArc(line, arc);
+               }
+               // arc / arc:
+               //
+               else if (te1->rtti() == RS2::EntityArc && te2->rtti() == RS2::EntityArc)
+               {
+                       RS_Arc * arc1 = (RS_Arc *)te1;
+                       RS_Arc * arc2 = (RS_Arc *)te2;
+                       ret = getIntersectionArcArc(arc1, arc2);
+               }
+               else
+               {
+                       RS_DEBUG->print("RS_Information::getIntersection:: Unsupported entity type.");
+               }
+       }
 
+       // Check all intersection points for being on entities:
+       //
+       if (onEntities)
+       {
+               if (!e1->isPointOnEntity(ret.get(0), tol) || !e2->isPointOnEntity(ret.get(0), tol))
+               {
+                       ret.set(0, Vector(false));
+               }
 
+               if (!e1->isPointOnEntity(ret.get(1), tol) || !e2->isPointOnEntity(ret.get(1), tol))
+               {
+                       ret.set(1, Vector(false));
+               }
 
-/**
- * @return Intersection between two lines.
- */
-VectorSolutions RS_Information::getIntersectionLineLine(RS_Line* e1,
-        RS_Line* e2) {
+               if (!e1->isPointOnEntity(ret.get(2), tol) || !e2->isPointOnEntity(ret.get(2), tol))
+               {
+                       ret.set(2, Vector(false));
+               }
 
-    VectorSolutions ret;
+               if (!e1->isPointOnEntity(ret.get(3), tol) || !e2->isPointOnEntity(ret.get(3), tol))
+               {
+                       ret.set(3, Vector(false));
+               }
+       }
 
-    if (e1==NULL || e2==NULL) {
-        return ret;
-    }
+       int k = 0;
+       for(int i=0; i<4; ++i)
+       {
+               if (ret.get(i).valid)
+               {
+                       ret.set(k, ret.get(i));
+                       k++;
+               }
+       }
 
-    Vector p1 = e1->getStartpoint();
-    Vector p2 = e1->getEndpoint();
-    Vector p3 = e2->getStartpoint();
-    Vector p4 = e2->getEndpoint();
+       for (int i=k; i<4; ++i)
+       {
+               ret.set(i, Vector(false));
+       }
 
-    double num = ((p4.x-p3.x)*(p1.y-p3.y) - (p4.y-p3.y)*(p1.x-p3.x));
-    double div = ((p4.y-p3.y)*(p2.x-p1.x) - (p4.x-p3.x)*(p2.y-p1.y));
+       return ret;
+}
 
-    if (fabs(div)>RS_TOLERANCE) {
-        double u = num / div;
+/**
+ * @return Intersection between two lines.
+ */
+VectorSolutions RS_Information::getIntersectionLineLine(RS_Line * e1, RS_Line * e2)
+{
+       VectorSolutions ret;
 
-        double xs = p1.x + u * (p2.x-p1.x);
-        double ys = p1.y + u * (p2.y-p1.y);
-        ret = VectorSolutions(Vector(xs, ys));
-    }
+       if (!e1 || !e2)
+               return ret;
 
-    // lines are parallel
-    else {
-        ret = VectorSolutions();
-    }
+       Vector p1 = e1->getStartpoint();
+       Vector p2 = e1->getEndpoint();
+       Vector p3 = e2->getStartpoint();
+       Vector p4 = e2->getEndpoint();
 
-    return ret;
-}
+       double num = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x));
+       double div = ((p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y));
 
+       if (fabs(div) > RS_TOLERANCE)
+       {
+               double u = num / div;
+               double xs = p1.x + u * (p2.x - p1.x);
+               double ys = p1.y + u * (p2.y - p1.y);
+               ret = VectorSolutions(Vector(xs, ys));
+       }
+       // lines are parallel
+       else
+               ret = VectorSolutions();
 
+       return ret;
+}
 
 /**
  * @return One or two intersection points between given entities.
  */
-VectorSolutions RS_Information::getIntersectionLineArc(RS_Line* line,
-        RS_Arc* arc) {
-
-    VectorSolutions ret;
-
-    if (line==NULL || arc==NULL) {
-        return ret;
-    }
-
-    double dist=0.0;
-    Vector nearest;
-    nearest = line->getNearestPointOnEntity(arc->getCenter(), false, &dist);
-
-    // special case: arc touches line (tangent):
-    if (fabs(dist - arc->getRadius()) < 1.0e-4) {
-        ret = VectorSolutions(nearest);
-        ret.setTangent(true);
-        return ret;
-    }
-
-    Vector p = line->getStartpoint();
-    Vector d = line->getEndpoint() - line->getStartpoint();
-    if (d.magnitude()<1.0e-6) {
-        return ret;
-    }
-
-    Vector c = arc->getCenter();
-    double r = arc->getRadius();
-    Vector delta = p - c;
-
-    // root term:
-    double term = RS_Math::pow(Vector::dotP(d, delta), 2.0)
-                  - RS_Math::pow(d.magnitude(), 2.0)
-                  * (RS_Math::pow(delta.magnitude(), 2.0) - RS_Math::pow(r, 2.0));
-
-    // no intersection:
-    if (term<0.0) {
-        VectorSolutions s;
-        ret = s;
-    }
-
-    // one or two intersections:
-    else {
-        double t1 = (- Vector::dotP(d, delta) + sqrt(term))
-                    / RS_Math::pow(d.magnitude(), 2.0);
-        double t2;
-        bool tangent = false;
-
-        // only one intersection:
-        if (fabs(term)<RS_TOLERANCE) {
-            t2 = t1;
-            tangent = true;
-        }
-
-        // two intersections
-        else {
-            t2 = (-Vector::dotP(d, delta) - sqrt(term))
-                 / RS_Math::pow(d.magnitude(), 2.0);
-        }
-
-        Vector sol1;
-        Vector sol2(false);
-
-        sol1 = p + d * t1;
-
-        if (!tangent) {
-            sol2 = p + d * t2;
-        }
-
-        ret = VectorSolutions(sol1, sol2);
-        ret.setTangent(tangent);
-    }
-
-    return ret;
-}
+VectorSolutions RS_Information::getIntersectionLineArc(RS_Line * line, RS_Arc * arc)
+{
+       VectorSolutions ret;
+
+       if (line==NULL || arc==NULL) {
+               return ret;
+       }
 
+       double dist=0.0;
+       Vector nearest;
+       nearest = line->getNearestPointOnEntity(arc->getCenter(), false, &dist);
 
+       // special case: arc touches line (tangent):
+       if (fabs(dist - arc->getRadius()) < 1.0e-4) {
+               ret = VectorSolutions(nearest);
+               ret.setTangent(true);
+               return ret;
+       }
 
-/**
- * @return One or two intersection points between given entities.
- */
-VectorSolutions RS_Information::getIntersectionArcArc(RS_Arc* e1,
-        RS_Arc* e2) {
+       Vector p = line->getStartpoint();
+       Vector d = line->getEndpoint() - line->getStartpoint();
+       if (d.magnitude()<1.0e-6) {
+               return ret;
+       }
+
+       Vector c = arc->getCenter();
+       double r = arc->getRadius();
+       Vector delta = p - c;
 
-    VectorSolutions ret;
+       // root term:
+       double term = RS_Math::pow(Vector::dotP(d, delta), 2.0)
+                               - RS_Math::pow(d.magnitude(), 2.0)
+                               * (RS_Math::pow(delta.magnitude(), 2.0) - RS_Math::pow(r, 2.0));
+
+       // no intersection:
+       if (term<0.0) {
+               VectorSolutions s;
+               ret = s;
+       }
 
-    if (e1==NULL || e2==NULL) {
-        return ret;
-    }
+       // one or two intersections:
+       else {
+               double t1 = (- Vector::dotP(d, delta) + sqrt(term))
+                                       / RS_Math::pow(d.magnitude(), 2.0);
+               double t2;
+               bool tangent = false;
+
+               // only one intersection:
+               if (fabs(term)<RS_TOLERANCE) {
+                       t2 = t1;
+                       tangent = true;
+               }
+
+               // two intersections
+               else {
+                       t2 = (-Vector::dotP(d, delta) - sqrt(term))
+                               / RS_Math::pow(d.magnitude(), 2.0);
+               }
+
+               Vector sol1;
+               Vector sol2(false);
+
+               sol1 = p + d * t1;
+
+               if (!tangent) {
+                       sol2 = p + d * t2;
+               }
 
-    Vector c1 = e1->getCenter();
-    Vector c2 = e2->getCenter();
+               ret = VectorSolutions(sol1, sol2);
+               ret.setTangent(tangent);
+       }
 
-    double r1 = e1->getRadius();
-    double r2 = e2->getRadius();
+       return ret;
+}
 
-    Vector u = c2 - c1;
+/**
+ * @return One or two intersection points between given entities.
+ */
+VectorSolutions RS_Information::getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2)
+{
+       VectorSolutions ret;
 
-    // concentric
-    if (u.magnitude()<1.0e-6) {
-        return ret;
-    }
+       if (e1==NULL || e2==NULL) {
+               return ret;
+       }
 
-    Vector v = Vector(u.y, -u.x);
+       Vector c1 = e1->getCenter();
+       Vector c2 = e2->getCenter();
 
-    double s, t1, t2, term;
+       double r1 = e1->getRadius();
+       double r2 = e2->getRadius();
 
-    s = 1.0/2.0 * ((r1*r1 - r2*r2)/(RS_Math::pow(u.magnitude(), 2.0)) + 1.0);
+       Vector u = c2 - c1;
 
-    term = (r1*r1)/(RS_Math::pow(u.magnitude(), 2.0)) - s*s;
+       // concentric
+       if (u.magnitude()<1.0e-6) {
+               return ret;
+       }
 
-    // no intersection:
-    if (term<0.0) {
-        ret = VectorSolutions();
-    }
+       Vector v = Vector(u.y, -u.x);
 
-    // one or two intersections:
-    else {
-        t1 = sqrt(term);
-        t2 = -sqrt(term);
-        bool tangent = false;
+       double s, t1, t2, term;
 
-        Vector sol1 = c1 + u*s + v*t1;
-        Vector sol2 = c1 + u*s + v*t2;
+       s = 1.0/2.0 * ((r1*r1 - r2*r2)/(RS_Math::pow(u.magnitude(), 2.0)) + 1.0);
 
-        if (sol1.distanceTo(sol2)<1.0e-4) {
-            sol2 = Vector(false);
-            ret = VectorSolutions(sol1);
-            tangent = true;
-        } else {
-            ret = VectorSolutions(sol1, sol2);
-        }
+       term = (r1*r1)/(RS_Math::pow(u.magnitude(), 2.0)) - s*s;
 
-        ret.setTangent(tangent);
-    }
+       // no intersection:
+       if (term<0.0) {
+               ret = VectorSolutions();
+       }
 
-    return ret;
-}
+       // one or two intersections:
+       else {
+               t1 = sqrt(term);
+               t2 = -sqrt(term);
+               bool tangent = false;
+
+               Vector sol1 = c1 + u*s + v*t1;
+               Vector sol2 = c1 + u*s + v*t2;
+
+               if (sol1.distanceTo(sol2)<1.0e-4) {
+                       sol2 = Vector(false);
+                       ret = VectorSolutions(sol1);
+                       tangent = true;
+               } else {
+                       ret = VectorSolutions(sol1, sol2);
+               }
 
+               ret.setTangent(tangent);
+       }
 
+       return ret;
+}
 
 /**
  * @return One or two intersection points between given entities.
  */
-VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line* line,
-        RS_Ellipse* ellipse) {
-
-    VectorSolutions ret;
-
-    if (line==NULL || ellipse==NULL) {
-        return ret;
-    }
-
-    // rotate into normal position:
-    double ang = ellipse->getAngle();
-
-    double rx = ellipse->getMajorRadius();
-    double ry = ellipse->getMinorRadius();
-    Vector center = ellipse->getCenter();
-    Vector a1 = line->getStartpoint().rotate(center, -ang);
-    Vector a2 = line->getEndpoint().rotate(center, -ang);
-    Vector origin = a1;
-    Vector dir = a2-a1;
-    Vector diff = origin - center;
-    Vector mDir = Vector(dir.x/(rx*rx), dir.y/(ry*ry));
-    Vector mDiff = Vector(diff.x/(rx*rx), diff.y/(ry*ry));
-
-    double a = Vector::dotP(dir, mDir);
-    double b = Vector::dotP(dir, mDiff);
-    double c = Vector::dotP(diff, mDiff) - 1.0;
-    double d = b*b - a*c;
-
-    if (d < 0) {
-        RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 0");
-    } else if ( d > 0 ) {
-        double root = sqrt(d);
-        double t_a = (-b - root) / a;
-        double t_b = (-b + root) / a;
-
-        /*if ( (t_a < 0 || 1 < t_a) && (t_b < 0 || 1 < t_b) ) {
-            if ( (t_a < 0 && t_b < 0) || (t_a > 1 && t_b > 1) ) {
-                RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 1");
-            }
-            else {
-                RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: inside 1");
-            }
-        } else {*/
-            RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1");
-            Vector ret1(false);
-            Vector ret2(false);
-            //if ( 0 <= t_a && t_a <= 1 ) {
-                //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_a<=1");
-                ret1 = a1.lerp(a2, t_a);
-                RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y);
-            //}
-            //if ( 0 <= t_b && t_b <= 1 ) {
-                //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_b<=1");
-                ret2 = a1.lerp(a2, t_b);
-                RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret2: %f/%f", ret2.x, ret2.y);
-            //}
-            if (ret1.valid && ret2.valid) {
-                ret = VectorSolutions(ret1, ret2);
-            }
-            else {
-                if (ret1.valid) {
-                    ret = VectorSolutions(ret1);
-                }
-                if (ret2.valid) {
-                    ret = VectorSolutions(ret2);
-                }
-            }
-        //}
-    } else {
-        double t = -b/a;
-        if ( 0 <= t && t <= 1 ) {
-            RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t<=1");
-            RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 2");
-            ret = VectorSolutions(a1.lerp(a2, t));
-            RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret.get(0).x, ret.get(0).y);
-        } else {
-            RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 2");
-        }
-    }
-
-    ret.rotate(center, ang);
-    return ret;
-
-
-
-    /*
-    RS_Arc* arc = new RS_Arc(NULL,
-                             RS_ArcData(ellipse->getCenter(),
-                                        ellipse->getMajorRadius(),
-                                        ellipse->getAngle1(),
-                                        ellipse->getAngle2(),
-                                        false));
-    RS_Line* other = (RS_Line*)line->clone();
-    double angle = ellipse->getAngle();
-    //double ratio = ellipse->getRatio();
-
-    // rotate entities:
-    other->rotate(ellipse->getCenter(), -angle);
-    other->scale(ellipse->getCenter(), Vector(1.0, 1.0/ellipse->getRatio()));
-
-    ret = getIntersectionLineArc(other, arc);
-
-    ret.scale(ellipse->getCenter(), Vector(1.0, ellipse->getRatio()));
-    ret.rotate(ellipse->getCenter(), angle);
-
-    delete arc;
-    delete other;
-
-    return ret;
-    */
-}
+VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line * line, RS_Ellipse * ellipse)
+{
+       VectorSolutions ret;
 
+       if (line==NULL || ellipse==NULL) {
+               return ret;
+       }
+
+       // rotate into normal position:
+       double ang = ellipse->getAngle();
+
+       double rx = ellipse->getMajorRadius();
+       double ry = ellipse->getMinorRadius();
+       Vector center = ellipse->getCenter();
+       Vector a1 = line->getStartpoint().rotate(center, -ang);
+       Vector a2 = line->getEndpoint().rotate(center, -ang);
+       Vector origin = a1;
+       Vector dir = a2-a1;
+       Vector diff = origin - center;
+       Vector mDir = Vector(dir.x/(rx*rx), dir.y/(ry*ry));
+       Vector mDiff = Vector(diff.x/(rx*rx), diff.y/(ry*ry));
+
+       double a = Vector::dotP(dir, mDir);
+       double b = Vector::dotP(dir, mDiff);
+       double c = Vector::dotP(diff, mDiff) - 1.0;
+       double d = b*b - a*c;
+
+       if (d < 0) {
+               RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 0");
+       } else if ( d > 0 ) {
+               double root = sqrt(d);
+               double t_a = (-b - root) / a;
+               double t_b = (-b + root) / a;
+
+               /*if ( (t_a < 0 || 1 < t_a) && (t_b < 0 || 1 < t_b) ) {
+                       if ( (t_a < 0 && t_b < 0) || (t_a > 1 && t_b > 1) ) {
+                               RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 1");
+                       }
+                       else {
+                               RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: inside 1");
+                       }
+               } else {*/
+                       RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1");
+                       Vector ret1(false);
+                       Vector ret2(false);
+                       //if ( 0 <= t_a && t_a <= 1 ) {
+                               //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_a<=1");
+                               ret1 = a1.lerp(a2, t_a);
+                               RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y);
+                       //}
+                       //if ( 0 <= t_b && t_b <= 1 ) {
+                               //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_b<=1");
+                               ret2 = a1.lerp(a2, t_b);
+                               RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret2: %f/%f", ret2.x, ret2.y);
+                       //}
+                       if (ret1.valid && ret2.valid) {
+                               ret = VectorSolutions(ret1, ret2);
+                       }
+                       else {
+                               if (ret1.valid) {
+                                       ret = VectorSolutions(ret1);
+                               }
+                               if (ret2.valid) {
+                                       ret = VectorSolutions(ret2);
+                               }
+                       }
+               //}
+       } else {
+               double t = -b/a;
+               if ( 0 <= t && t <= 1 ) {
+                       RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t<=1");
+                       RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 2");
+                       ret = VectorSolutions(a1.lerp(a2, t));
+                       RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret.get(0).x, ret.get(0).y);
+               } else {
+                       RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: outside 2");
+               }
+       }
+
+       ret.rotate(center, ang);
+       return ret;
+
+
+
+       /*
+       RS_Arc* arc = new RS_Arc(NULL,
+                                                       RS_ArcData(ellipse->getCenter(),
+                                                                               ellipse->getMajorRadius(),
+                                                                               ellipse->getAngle1(),
+                                                                               ellipse->getAngle2(),
+                                                                               false));
+       RS_Line* other = (RS_Line*)line->clone();
+       double angle = ellipse->getAngle();
+       //double ratio = ellipse->getRatio();
+
+       // rotate entities:
+       other->rotate(ellipse->getCenter(), -angle);
+       other->scale(ellipse->getCenter(), Vector(1.0, 1.0/ellipse->getRatio()));
+
+       ret = getIntersectionLineArc(other, arc);
+
+       ret.scale(ellipse->getCenter(), Vector(1.0, ellipse->getRatio()));
+       ret.rotate(ellipse->getCenter(), angle);
+
+       delete arc;
+       delete other;
+
+       return ret;
+       */
+}
 
 /**
  * Checks if the given coordinate is inside the given contour.
@@ -672,151 +651,175 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line* line,
  * @param onContour Will be set to true if the given point it exactly
  *         on the contour.
  */
-bool RS_Information::isPointInsideContour(const Vector& point,
-        RS_EntityContainer* contour, bool* onContour) {
-
-    if (contour==NULL) {
-        RS_DEBUG->print(RS_Debug::D_WARNING,
+bool RS_Information::isPointInsideContour(const Vector & point,
+       RS_EntityContainer * contour, bool * onContour)
+{
+       if (contour==NULL) {
+               RS_DEBUG->print(RS_Debug::D_WARNING,
                        "RS_Information::isPointInsideContour: contour is NULL");
-        return false;
-    }
-
-    if (point.x < contour->getMin().x || point.x > contour->getMax().x ||
-            point.y < contour->getMin().y || point.y > contour->getMax().y) {
-        return false;
-    }
-
-    double width = contour->getSize().x+1.0;
-
-    bool sure;
-    int counter;
-    int tries = 0;
-    double rayAngle = 0.0;
-    do {
-        sure = true;
-
-        // create ray:
-        Vector v;
-        v.setPolar(width*10.0, rayAngle);
-        RS_Line ray(NULL, RS_LineData(point, point+v));
-        counter = 0;
-        VectorSolutions sol;
-
-        if (onContour!=NULL) {
-            *onContour = false;
-        }
-
-        for (RS_Entity* e = contour->firstEntity(RS2::ResolveAll);
-                e!=NULL;
-                e = contour->nextEntity(RS2::ResolveAll)) {
-
-            // intersection(s) from ray with contour entity:
-            sol = RS_Information::getIntersection(&ray, e, true);
-
-            for (int i=0; i<=1; ++i) {
-                Vector p = sol.get(i);
-
-                if (p.valid) {
-                    // point is on the contour itself
-                    if (p.distanceTo(point)<1.0e-5) {
-                        if (onContour!=NULL) {
-                            *onContour = true;
-                        }
-                    } else {
-                        if (e->rtti()==RS2::EntityLine) {
-                            RS_Line* line = (RS_Line*)e;
-
-                            // ray goes through startpoint of line:
-                            if (p.distanceTo(line->getStartpoint())<1.0e-4) {
-                                if (RS_Math::correctAngle(line->getAngle1())<M_PI) {
-                                    counter++;
-                                    sure = false;
-                                }
-                            }
-
-                            // ray goes through endpoint of line:
-                            else if (p.distanceTo(line->getEndpoint())<1.0e-4) {
-                                if (RS_Math::correctAngle(line->getAngle2())<M_PI) {
-                                    counter++;
-                                    sure = false;
-                                }
-                            }
-                            // ray goes through the line:
-
-
-                            else {
-                                counter++;
-                            }
-                        } else if (e->rtti()==RS2::EntityArc) {
-                            RS_Arc* arc = (RS_Arc*)e;
-
-                            if (p.distanceTo(arc->getStartpoint())<1.0e-4) {
-                                double dir = arc->getDirection1();
-                                if ((dir<M_PI && dir>=1.0e-5) ||
-                                        ((dir>2*M_PI-1.0e-5 || dir<1.0e-5) &&
-                                         arc->getCenter().y>p.y)) {
-                                    counter++;
-                                    sure = false;
-                                }
-                            }
-                            else if (p.distanceTo(arc->getEndpoint())<1.0e-4) {
-                                double dir = arc->getDirection2();
-                                if ((dir<M_PI && dir>=1.0e-5) ||
-                                        ((dir>2*M_PI-1.0e-5 || dir<1.0e-5) &&
-                                         arc->getCenter().y>p.y)) {
-                                    counter++;
-                                    sure = false;
-                                }
-                            } else {
-                                counter++;
-                            }
-                        } else if (e->rtti()==RS2::EntityCircle) {
-                            // tangent:
-                            if (i==0 && sol.get(1).valid==false) {
-                                if (!sol.isTangent()) {
-                                    counter++;
-                                } else {
-                                    sure = false;
-                                }
-                            } else if (i==1 || sol.get(1).valid==true) {
-                                counter++;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        rayAngle+=0.02;
-        tries++;
-    }
-    while (!sure && rayAngle<2*M_PI && tries<6);
-
-    // remove double intersections:
-    /*
-       Q3PtrList<Vector> is2;
-       bool done;
-    Vector* av;
-       do {
-           done = true;
-           double minDist = RS_MAXDOUBLE;
-           double dist;
-       av = NULL;
-           for (Vector* v = is.first(); v!=NULL; v = is.next()) {
-               dist = point.distanceTo(*v);
-               if (dist<minDist) {
-                   minDist = dist;
-                   done = false;
-                       av = v;
-               }
-           }
-
-       if (!done && av!=NULL) {
-               is2.append(*av);
-       }
-       } while (!done);
-    */
-
-    return ((counter%2)==1);
-}
+               return false;
+       }
+
+       if (point.x < contour->getMin().x || point.x > contour->getMax().x ||
+               point.y < contour->getMin().y || point.y > contour->getMax().y)
+               return false;
+
+       double width = contour->getSize().x+1.0;
+       bool sure;
+       int counter;
+       int tries = 0;
+       double rayAngle = 0.0;
+
+       do
+       {
+               sure = true;
+
+               // create ray:
+               Vector v;
+               v.setPolar(width*10.0, rayAngle);
+               RS_Line ray(NULL, RS_LineData(point, point+v));
+               counter = 0;
+               VectorSolutions sol;
+
+               if (onContour)
+                       *onContour = false;
+
+               for(RS_Entity * e=contour->firstEntity(RS2::ResolveAll); e!=NULL;
+                       e=contour->nextEntity(RS2::ResolveAll))
+               {
+                       // intersection(s) from ray with contour entity:
+                       sol = RS_Information::getIntersection(&ray, e, true);
+
+                       for(int i=0; i<=1; ++i)
+                       {
+                               Vector p = sol.get(i);
+
+                               if (p.valid)
+                               {
+                                       // point is on the contour itself
+                                       if (p.distanceTo(point) < 1.0e-5)
+                                       {
+                                               if (onContour)
+                                               {
+                                                       *onContour = true;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               if (e->rtti() == RS2::EntityLine)
+                                               {
+                                                       RS_Line * line = (RS_Line *)e;
+
+                                                       // ray goes through startpoint of line:
+                                                       if (p.distanceTo(line->getStartpoint()) < 1.0e-4)
+                                                       {
+                                                               if (RS_Math::correctAngle(line->getAngle1()) < M_PI)
+                                                               {
+                                                                       counter++;
+                                                                       sure = false;
+                                                               }
+                                                       }
+                                                       // ray goes through endpoint of line:
+                                                       else if (p.distanceTo(line->getEndpoint()) < 1.0e-4)
+                                                       {
+                                                               if (RS_Math::correctAngle(line->getAngle2()) < M_PI)
+                                                               {
+                                                                       counter++;
+                                                                       sure = false;
+                                                               }
+                                                       }
+                                                       // ray goes through the line:
+                                                       else
+                                                       {
+                                                               counter++;
+                                                       }
+                                               }
+                                               else if (e->rtti() == RS2::EntityArc)
+                                               {
+                                                       RS_Arc * arc = (RS_Arc *)e;
+
+                                                       if (p.distanceTo(arc->getStartpoint()) < 1.0e-4)
+                                                       {
+                                                               double dir = arc->getDirection1();
+
+                                                               if ((dir < M_PI && dir >= 1.0e-5)
+                                                                       || ((dir > 2 * M_PI - 1.0e-5 || dir < 1.0e-5)
+                                                                       && arc->getCenter().y > p.y))
+                                                               {
+                                                                       counter++;
+                                                                       sure = false;
+                                                               }
+                                                       }
+                                                       else if (p.distanceTo(arc->getEndpoint()) < 1.0e-4)
+                                                       {
+                                                               double dir = arc->getDirection2();
+
+                                                               if ((dir < M_PI && dir >= 1.0e-5)
+                                                                       || ((dir > 2 * M_PI - 1.0e-5 || dir < 1.0e-5)
+                                                                       && arc->getCenter().y>p.y))
+                                                               {
+                                                                       counter++;
+                                                                       sure = false;
+                                                               }
+                                                       }
+                                                       else
+                                                       {
+                                                               counter++;
+                                                       }
+                                               }
+                                               else if (e->rtti() == RS2::EntityCircle)
+                                               {
+                                                       // tangent:
+                                                       if (i == 0 && sol.get(1).valid == false)
+                                                       {
+                                                               if (!sol.isTangent())
+                                                               {
+                                                                       counter++;
+                                                               }
+                                                               else
+                                                               {
+                                                                       sure = false;
+                                                               }
+                                                       }
+                                                       else if (i == 1 || sol.get(1).valid)
+                                                       {
+                                                               counter++;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               rayAngle += 0.02;
+               tries++;
+       }
+       while (!sure && rayAngle < 2 * M_PI && tries < 6);
+
+       // remove double intersections:
+       /*
+               Q3PtrList<Vector> is2;
+               bool done;
+       Vector* av;
+               do {
+                       done = true;
+                       double minDist = RS_MAXDOUBLE;
+                       double dist;
+               av = NULL;
+                       for (Vector* v = is.first(); v!=NULL; v = is.next()) {
+                               dist = point.distanceTo(*v);
+                               if (dist<minDist) {
+                                       minDist = dist;
+                                       done = false;
+                               av = v;
+                               }
+                       }
+
+               if (!done && av!=NULL) {
+                       is2.append(*av);
+               }
+               } while (!done);
+       */
 
+       return ((counter % 2) == 1);
+}
index 21a91234dbace54a9e5398261868a05d06fa6c53..57175e24960c4de1207e29bc14e8ba2200a9c3e4 100644 (file)
@@ -22,19 +22,16 @@ class RS_Information
                static bool isDimension(RS2::EntityType type);
                static bool isTrimmable(RS_Entity * e);
                static bool isTrimmable(RS_Entity * e1, RS_Entity * e2);
-
                Vector getNearestEndpoint(const Vector & point, double * dist = NULL) const;
                Vector getNearestPointOnEntity(const Vector & point, bool onEntity = true,
                        double * dist = NULL, RS_Entity ** entity = NULL) const;
                RS_Entity * getNearestEntity(const Vector & point, double * dist = NULL,
                        RS2::ResolveLevel level = RS2::ResolveAll) const;
-
                static VectorSolutions getIntersection(RS_Entity * e1, RS_Entity * e2, bool onEntities = false);
                static VectorSolutions getIntersectionLineLine(RS_Line * e1, RS_Line * e2);
                static VectorSolutions getIntersectionLineArc(RS_Line * line, RS_Arc * arc);
                static VectorSolutions getIntersectionArcArc(RS_Arc * e1, RS_Arc * e2);
                static VectorSolutions getIntersectionLineEllipse(RS_Line * line, RS_Ellipse * ellipse);
-
                static bool isPointInsideContour(const Vector & point, RS_EntityContainer * contour,
                        bool * onContour = NULL);
 
index 2b566860b4112301e38c376dfe73d9ecc7470b24..36e8da7d39fdd19ec01ea68dd1f8db0ac5913e7e 100644 (file)
@@ -3,9 +3,9 @@
 
 #include <stddef.h>
 
-#ifdef __hpux
-#include <sys/_size_t.h>
-#endif
+//#ifdef __hpux
+//#include <sys/_size_t.h>
+//#endif
 
 #include <iostream>
 #include <QtCore>
index ac03f6ec435a14b64f663d6715064ffec5457687..56c169e8c26ac58a0500875dca1ffee3205ee9a1 100644 (file)
 
 #include "rs_layerlist.h"
 
-#include "rs_layer.h"
-#include "rs_layerlistlistener.h"
+//#include "rs_layerlistlistener.h"
+#include "rs_debug.h"
 #include "rs_entity.h"
+#include "rs_layer.h"
 
 /**
  * Default constructor.
@@ -100,6 +101,7 @@ void RS_LayerList::activate(RS_Layer * layer, bool notify)
 
        activeLayer = layer;
 
+#if 0
        if (notify)
        {
                for(int i=0; i<layerListListeners.count(); ++i)
@@ -109,6 +111,7 @@ void RS_LayerList::activate(RS_Layer * layer, bool notify)
                        RS_DEBUG->print("RS_LayerList::activate listener notified");
                }
        }
+#endif
 
        RS_DEBUG->print("RS_LayerList::activate end");
 }
@@ -141,17 +144,19 @@ void RS_LayerList::add(RS_Layer * layer)
        {
                layers.append(layer);
 
+#if 0
                // notify listeners
                for(int i=0; i<layerListListeners.count(); ++i)
                {
                        RS_LayerListListener * l = layerListListeners.at(i);
                        l->layerAdded(layer);
                }
+#endif
 
                setModified(true);
 
                // if there was no active layer so far, activate this one.
-               if (activeLayer ==NULL)
+               if (activeLayer == NULL)
                        activate(layer);
        }
        else
@@ -186,11 +191,13 @@ void RS_LayerList::remove(RS_Layer * layer)
        if (idx != -1)
                layers.takeAt(idx);
 
+#if 0
        for(int i=0; i<layerListListeners.count(); ++i)
        {
                RS_LayerListListener * l = layerListListeners.at(i);
                l->layerRemoved(layer);
        }
+#endif
 
        setModified(true);
 
@@ -209,16 +216,18 @@ void RS_LayerList::remove(RS_Layer * layer)
  */
 void RS_LayerList::edit(RS_Layer * layer, const RS_Layer & source)
 {
-       if (layer == NULL)
+       if (!layer)
                return;
 
        *layer = source;
 
+#if 0
        for(int i=0; i<layerListListeners.count(); ++i)
        {
                RS_LayerListListener * l = layerListListeners.at(i);
                l->layerEdited(layer);
        }
+#endif
 
        setModified(true);
 }
@@ -233,7 +242,6 @@ RS_Layer * RS_LayerList::find(const QString & name)
 
        RS_Layer * ret = NULL;
 
-//     for(RS_Layer * l=layers.first(); l!=NULL; l=layers.next())
        for(int i=0; i<layers.size(); i++)
        {
                RS_Layer * l = layers[i];
@@ -332,17 +340,19 @@ void RS_LayerList::toggle(const QString & name)
  */
 void RS_LayerList::toggle(RS_Layer * layer)
 {
-       if (layer == NULL)
+       if (!layer)
                return;
 
        layer->toggle();
 
+#if 0
        // Notify listeners:
        for(int i=0; i < layerListListeners.count(); ++i)
        {
                RS_LayerListListener * l = layerListListeners.at(i);
                l->layerToggled(layer);
        }
+#endif
 }
 
 /**
@@ -351,17 +361,19 @@ void RS_LayerList::toggle(RS_Layer * layer)
  */
 void RS_LayerList::toggleLock(RS_Layer * layer)
 {
-       if (layer == NULL)
+       if (!layer)
                return;
 
        layer->toggleLock();
 
+#if 0
        // Notify listeners:
        for(int i=0; i<layerListListeners.count(); ++i)
        {
                RS_LayerListListener * l = layerListListeners.at(i);
                l->layerToggled(layer);
        }
+#endif
 }
 
 /**
@@ -374,13 +386,16 @@ void RS_LayerList::freezeAll(bool freeze)
        for(uint l=0; l<count(); l++)
                at(l)->freeze(freeze);
 
+#if 0
        for(int i=0; i<layerListListeners.count(); ++i)
        {
                RS_LayerListListener * l = layerListListeners.at(i);
                l->layerToggled(NULL);
        }
+#endif
 }
 
+#if 0
 /**
  * adds a LayerListListener to the list of listeners. Listeners
  * are notified when the layer list changes.
@@ -404,6 +419,7 @@ void RS_LayerList::removeListener(RS_LayerListListener * listener)
        if (i != -1)
                layerListListeners.takeAt(i);
 }
+#endif
 
 /**
  * Sets the layer lists modified status to 'm'.
index 1a8a91e3ae21909edebec75f6d85052c1ad6417a..0dcdfbda7616901d6707aeca3bf6317253e4aab0 100644 (file)
@@ -5,7 +5,7 @@
 #include <QtCore>
 
 class RS_Layer;
-class RS_LayerListListener;
+//class RS_LayerListListener;
 
 /**
  * A list of layers.
@@ -34,8 +34,8 @@ class RS_LayerList
                void toggle(RS_Layer * layer);
                void toggleLock(RS_Layer * layer);
                void freezeAll(bool freeze);
-               void addListener(RS_LayerListListener * listener);
-               void removeListener(RS_LayerListListener * listener);
+//             void addListener(RS_LayerListListener * listener);
+//             void removeListener(RS_LayerListListener * listener);
                void setModified(bool m);
                virtual bool isModified() const;
 
@@ -43,11 +43,9 @@ class RS_LayerList
 
        private:
                //! layers in the graphic
-//             Q3PtrList<RS_Layer> layers;
                QList<RS_Layer *> layers;
                //! List of registered LayerListListeners
-//             Q3PtrList<RS_LayerListListener> layerListListeners;
-               QList<RS_LayerListListener *> layerListListeners;
+//             QList<RS_LayerListListener *> layerListListeners;
                //! Currently active layer
                RS_Layer * activeLayer;
                /** Flag set if the layer list was modified and not yet saved. */
diff --git a/src/base/rs_layerlistlistener.h b/src/base/rs_layerlistlistener.h
deleted file mode 100644 (file)
index 2164979..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef RS_LAYERLISTLISTENER_H
-#define RS_LAYERLISTLISTENER_H
-
-#include "rs_layer.h"
-
-/**
- * This class is an interface for classes that are interested in
- * knowing about changes in the layer list.
- */
-class RS_LayerListListener
-{
-       public:
-               RS_LayerListListener() {}
-               virtual ~RS_LayerListListener() {}
-
-               /**
-               * Called when the active layer changes.
-               */
-               virtual void layerActivated(RS_Layer *) {}
-
-               /**
-               * Called when a new layer is added to the list.
-               */
-               virtual void layerAdded(RS_Layer *) {}
-
-               /**
-               * Called when a layer is removed from the list.
-               */
-               virtual void layerRemoved(RS_Layer *) {}
-
-               /**
-               * Called when a layer's attributes are modified.
-               */
-               virtual void layerEdited(RS_Layer *) {}
-
-               /**
-               * Called when a layer's visibility is toggled.
-               */
-               virtual void layerToggled(RS_Layer *) {}
-};
-
-#endif
index 41fb0263bf1f1054e8bfcb7dfe3038f91054ff84..c4183f9369d90a08a5035a6f5b3d918b35f6c7f7 100644 (file)
@@ -212,7 +212,6 @@ class RS_Modification
 
                bool explode();
                bool explodeTextIntoLetters();
-//             bool explodeTextIntoLetters(RS_Text* text, Q3PtrList<RS_Entity>& addList);
                bool explodeTextIntoLetters(RS_Text * text, QList<RS_Entity *> & addList);
                bool moveRef(RS_MoveRefData & data);
 
@@ -228,7 +227,6 @@ class RS_Modification
 
        private:
                void deselectOriginals(bool remove);
-//             void addNewEntities(Q3PtrList<RS_Entity>& addList);
                void addNewEntities(QList<RS_Entity *> & addList);
 
        protected:
index da06c26ed4473a1b2438e95b41c8255bd21a651e..8e3814ea6386c6404c5ca3a79bff442e5d61b817 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "rs_solid.h"
 
+#include "rs_debug.h"
 #include "graphicview.h"
 #include "paintinterface.h"
 
index 1bd2ae0278e2b932516f964ab758e48d056cdf7e..87e44039453b55e26f52c3e37bef8bb6b6d65814 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef RS_UNDOABLE_H
 #define RS_UNDOABLE_H
 
+#include "rs.h"
 #include "rs_flags.h"
 
 class RS_UndoCycle;
index fbafedcb5bc6ba2f53bceb2dd34019e732f79c3b..42c90ccc72190f1325e2832dd608fe06b5a61449 100644 (file)
@@ -1903,6 +1903,7 @@ MDIWindow * ApplicationWindow::slotFileNew(RS_Document * doc)
        RS_DEBUG->print("  adding listeners");
        Drawing * graphic = w->getDocument()->getGraphic();
 
+#if 0
        if (graphic != NULL)
        {
                // Link the graphic's layer list to the pen tool bar
@@ -1912,6 +1913,7 @@ MDIWindow * ApplicationWindow::slotFileNew(RS_Document * doc)
                // Link the block list to the block widget
                graphic->addBlockListListener(blockWidget);
        }
+#endif
 
        // Link the dialog factory to the mouse widget:
        QG_DIALOGFACTORY->setMouseWidget(mouseWidget);
@@ -2603,14 +2605,16 @@ void ApplicationWindow::slotFilePrintPreview(bool on)
                                RS_DEBUG->print("  adding listeners");
                                Drawing * graphic = w->getDocument()->getGraphic();
 
-                               if (graphic != NULL)
+                               if (graphic)
                                {
+#if 0
                                        // Link the layer list to the pen tool bar
                                        graphic->addLayerListListener(penToolBar);
                                        // Link the layer list to the layer widget
                                        graphic->addLayerListListener(layerWidget);
                                        // Link the block list to the block widget
                                        graphic->addBlockListListener(blockWidget);
+#endif
                                        // Center by default:
                                        graphic->centerToPage();
                                }
index 1c94e2296c4e7e4266346c543ffe8e318adbd44b..4be0f714a4f9d4ca068307dd3460a11a3df75c13 100644 (file)
 
 #include "qg_blockwidget.h"
 
+#include "qg_actionhandler.h"
+#include "rs_block.h"
+#include "rs_blocklist.h"
+#include "rs_debug.h"
+
 /**
  * Constructor.
  */
@@ -173,12 +178,12 @@ void QG_BlockWidget::update()
 
        RS_Block * activeBlock = NULL;
 
-       if (blockList != NULL)
+       if (blockList)
                activeBlock = blockList->getActive();
 
        listBox->clear();
 
-       if (blockList == NULL)
+       if (!blockList)
        {
                RS_DEBUG->print("QG_BlockWidget::update(): blockList is NULL");
                return;
@@ -218,7 +223,7 @@ void QG_BlockWidget::highlightBlock(RS_Block * block)
 {
        RS_DEBUG->print("QG_BlockWidget::highlightBlock()");
 
-       if (block == NULL || listBox == NULL)
+       if (!block || !listBox)
                return;
 
        blockList->activate(block);
@@ -228,10 +233,8 @@ void QG_BlockWidget::highlightBlock(RS_Block * block)
        {
                QListWidgetItem * item = listBox->item(i);
 
-//             if (listBox->text(i) == name)
                if (item->text() == name)
                {
-//                     listBox->setCurrentItem(i);
                        listBox->setCurrentRow(i);
                        break;
                }
@@ -294,7 +297,7 @@ void QG_BlockWidget::slotActivated(void)
        QString blockName = listBox->currentItem()->text();
        RS_DEBUG->print("QG_BlockWidget::slotActivated(): %s", blockName.toLatin1().data());
 
-       if (blockList == NULL)
+       if (!blockList)
                return;
 
        lastBlock = blockList->getActive();
@@ -317,7 +320,7 @@ void QG_BlockWidget::slotMouseButtonClicked(QListWidgetItem * item)
        }
        else
        {
-               if (item != NULL && blockList != NULL)
+               if (item && blockList)
                        lastBlock = blockList->find(item->text());
        }
 }
index efb8e0471fc59ab65ebd8acea4e07884d6779306..701f5835f3d733305cd50a60092fe8f754ca4207 100644 (file)
@@ -2,15 +2,19 @@
 #define QG_BLOCKWIDGET_H
 
 #include <QtGui>
-#include "rs_blocklist.h"
-#include "rs_blocklistlistener.h"
-#include "qg_actionhandler.h"
+//#include "rs_blocklist.h"
+//#include "rs_blocklistlistener.h"
+//#include "qg_actionhandler.h"
+
+class RS_Block;
+class RS_BlockList;
+class QG_ActionHandler;
 
 /**
  * This is the Qt implementation of a widget which can view a
  * block list.
  */
-class QG_BlockWidget: public QWidget, public RS_BlockListListener
+class QG_BlockWidget: public QWidget//, public RS_BlockListListener
 {
     Q_OBJECT
 
index aee82b4097f3668cec79c8b99265e49b3733ad96..c7b3f0a6f6742dd46a14bb46ab4ea374d222cf1c 100644 (file)
@@ -24,6 +24,7 @@
 #include "rs_blocklist.h"
 #include "rs_document.h"
 #include "rs_hatch.h"
+#include "rs_layerlist.h"
 #include "rs_patternlist.h"
 #include "settings.h"
 #include "rs_system.h"
index b870809af51e246809d768aaa13defae1bd895d3..9d4cf8c508c9774568357081ce3320afa251e7e6 100644 (file)
@@ -3,8 +3,8 @@
 
 #include <QtGui>
 #include "graphicview.h"
-#include "rs_layerlistlistener.h"
-#include "rs_blocklistlistener.h"
+//#include "rs_layerlistlistener.h"
+//#include "rs_blocklistlistener.h"
 
 class RS_Document;
 class PaintInterface;
index 9f34842c518fdb0011183c7cdd1185acd9cd7d73..bb422c050deb08ee083593860286a71ce7537a58 100644 (file)
 
 #include "qg_layerwidget.h"
 
-/*#include "xpm/layerstatus_00.xpm"
-#include "xpm/layerstatus_01.xpm"
-#include "xpm/layerstatus_10.xpm"
-#include "xpm/layerstatus_11.xpm"
-#include "xpm/visibleblock.xpm"
-#include "xpm/hiddenblock.xpm"
-#include "xpm/layeradd.xpm"
-#include "xpm/layerremove.xpm"
-#include "xpm/layeredit.xpm"*/
+#include "qg_actionhandler.h"
+#include "rs_debug.h"
+#include "rs_layer.h"
+#include "rs_layerlist.h"
 
 /**
  * Constructor.
 QG_LayerWidget::QG_LayerWidget(QG_ActionHandler * ah, QWidget * parent,
        const char * name, Qt::WindowFlags f):
        QWidget(parent, f),
-/*     pxmLayerStatus00(layerstatus_00_xpm),
-       pxmLayerStatus01(layerstatus_01_xpm),
-       pxmLayerStatus10(layerstatus_10_xpm),
-       pxmLayerStatus11(layerstatus_11_xpm),
-       pxmVisible(visibleblock_xpm),
-       pxmHidden(hiddenblock_xpm),
-       pxmAdd(layeradd_xpm),
-       pxmRemove(layerremove_xpm),
-       pxmEdit(layeredit_xpm),
-       pxmDefreezeAll(visibleblock_xpm),
-       pxmFreezeAll(hiddenblock_xpm)*/
        pxmLayerStatus00(":/res/layerstatus_00.xpm"),
        pxmLayerStatus01(":/res/layerstatus_01.xpm"),
        pxmLayerStatus10(":/res/layerstatus_10.xpm"),
index 3f4a5af165ffb0365fb60690aafc69dab07a26fa..bddf87e9ac3647d1a27c0467d08a7977f27a08c7 100644 (file)
@@ -2,15 +2,19 @@
 #define QG_LAYERWIDGET_H
 
 #include <QtGui>
-#include "rs_layerlist.h"
-#include "rs_layerlistlistener.h"
-#include "qg_actionhandler.h"
+//#include "rs_layerlist.h"
+//#include "rs_layerlistlistener.h"
+//#include "qg_actionhandler.h"
+
+class QG_ActionHandler;
+class RS_Layer;
+class RS_LayerList;
 
 /**
  * This is the Qt implementation of a widget which can view a
  * layer list and provides a user interface for basic layer actions.
  */
-class QG_LayerWidget: public QWidget, public RS_LayerListListener
+class QG_LayerWidget: public QWidget//, public RS_LayerListListener
 {
     Q_OBJECT
 
@@ -34,7 +38,6 @@ class QG_LayerWidget: public QWidget, public RS_LayerListListener
                void escape();
 
        public slots:
-//             void slotActivated(const QString & layerName);
                void slotActivated(void);
 //             void slotMouseButtonClicked(int button, Q3ListBoxItem * item, const QPoint & pos);
                void slotMouseButtonClicked(QListWidgetItem *);
index 36b9299e96207a023d980b263f295899c0c6c686..426d9151f64fd2f69163e10b949db97998729114 100644 (file)
@@ -21,6 +21,7 @@
 #include "qg_colorbox.h"
 #include "qg_widthbox.h"
 #include "qg_linetypebox.h"
+#include "rs_layer.h"
 
 /**
  * Constructor.
index ffb3c7884cff348e1b5ac290121f2624827601bc..2b976e81bbf2d25ec2cbcaf19efe0fe254d0a34c 100644 (file)
@@ -2,17 +2,18 @@
 #define QG_PENTOOLBAR_H
 
 #include <QtGui>
-#include "rs_layerlistlistener.h"
+//#include "rs_layerlistlistener.h"
 #include "rs_pen.h"
 
 class QG_ColorBox;
 class QG_WidthBox;
 class QG_LineTypeBox;
+class RS_Layer;
 
 /**
  * A toolbar that offers all widgets for choosing a pen.
  */
-class QG_PenToolBar: public QToolBar, public RS_LayerListListener
+class QG_PenToolBar: public QToolBar//, public RS_LayerListListener
 {
        Q_OBJECT