]> Shamusworld >> Repos - architektonas/blobdiff - src/base/rs_layerlist.cpp
Adding missing implementation.
[architektonas] / src / base / rs_layerlist.cpp
index fc79decdf5f9f250084bd502129f9d3e11ec9d01..56c169e8c26ac58a0500875dca1ffee3205ee9a1 100644 (file)
@@ -1,34 +1,25 @@
-/****************************************************************************
-** $Id: rs_layerlist.cpp 1938 2004-12-09 23:09:53Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_layerlist.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -----------------------------------------------------------
+// JLH  06/01/2010  Added this text. :-)
+//
 
 #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.
@@ -110,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)
@@ -119,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");
 }
@@ -151,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
@@ -196,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);
 
@@ -219,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);
 }
@@ -243,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];
@@ -342,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
 }
 
 /**
@@ -361,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
 }
 
 /**
@@ -384,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.
@@ -414,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'.